package com.huluobo.a2112mvvmdouyindemo.demoMVP;

/**
 * Created by LC on 2024/3/21.
 */
public class LoginDemoPresenter {
    LoginDemoModel loginModel = new LoginDemoModel();

    LoginDemoView loginView;

    public LoginDemoPresenter(LoginDemoView loginView) {
        this.loginView = loginView;
    }

    public void login(String username, String password) {
        UserDemoBean user = loginModel.login(username, password);
        if (user != null) {
            //v层返回成功
            loginView.onSuccess(user);
        } else {
            //v层返回失败
            loginView.onFailed("登录失败");
        }
    }
}
